package main

import (
	"github.com/robfig/cron"
	"zimuzu_cvn_web_api/pkg/e"
	"zimuzu_cvn_web_api/service"
)

func cronInit() error {

	c := cron.New()
	c.AddFunc(e.CronSpecMin30, service.UpdateSlideShowDb)
	c.AddFunc(e.CronSpecMin1, service.CvntPledgeDraw)
	c.AddFunc(e.CronSpecMin1, service.ExpireAgent)
	//c.AddFunc(e.CronSpecMin1, service.RouterDraw)
	//c.AddFunc(e.CronSpecMin1, service.PCDraw)

	//生成金至尊码
	c.AddFunc(e.CronSpecSec30, service.GenVipCode)
	//生成令牌
	c.AddFunc(e.CronSpecSec10, service.GenTokenTask)
	//修改支付超时的令牌订单状态
	c.AddFunc(e.CronSpecMin30, service.TokenOrderOverdueDeal)
	//令牌回购队列检查
	c.AddFunc(e.CronSpecMin2, service.DealBuybackQueue)
	//生成令牌回购订单
	c.AddFunc(e.CronSpecMin3, service.GenBuybackOrder)

	c.Start()
	return nil
}
